﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using SchemaMonitor;
using SchemaMonitor.json;
using Framework;

public partial class pages_chapters_Comments : System.Web.UI.Page
{

    public int ChapterId { get { return CWeb.RequestInt("chapterId"); } }
    public CChapter Chapter { get { return CChapter.Cache.GetById(ChapterId) ?? CChapter.Cache[0]; } }

    protected void Page_Load(object sender, EventArgs e)
    {
        var u = new CUser(1);
        var r = Chapter.Node_(u).Root;
        var p = new CSoftPost(r, u);
        if (null == p.Comments || 0 == p.Comments.Count)
            ctrlComments.Visible = false;
        else
            ctrlComments.Display(p.Comments);
    }
}